import { defineStore } from 'pinia'
import shopImg1 from "../utils/images/huaweiIMGlittle/changxiang70X-1.png";
import shopImg2 from "../utils/images/huaweiIMGlittle/Mate70-1.png";
import shopImg3 from "../utils/images/huaweiIMGlittle/Mate70Pro1.png";
import shopImg4 from "../utils/images/huaweiIMGlittle/MateX6-1.png";
import shopImg5 from "../utils/images/huaweiIMGlittle/nova13-1.png";
import shopImg6 from "../utils/images/huaweiIMGlittle/pocket2-1.png";
import shopImg7 from "../utils/images/huaweiIMGlittle/pura70-1.png";
import shopImg8 from "../utils/images/huaweiIMGlittle/pura70pro1.png";
import loadingCountImg from "../utils/images/iamgeLoading.jpg";

export const useOrderListStore = defineStore('orderList',{
    //actions里面放置的是一个一个的动作函数
    actions:{
        setNewOrderList(value){
            //修改订单列表,这里的this指的是useOrderListStore这个函数
            if(value.length > 0){
                this.orderList = value
            }
        },
        setNewShopItemList(value){
          //修改订单列表,这里的this指的是useOrderListStore这个函数
          if(value.length > 0){
            //将所有空白图片修改为待审核
            for(let i = 0;i<value.length;i++){
              // console.log(value[i].imgPrice);
              if(!value[i].imgUrl){
                value[i].imgUrl = loadingCountImg
              }
            }
            // this.shopItemList = value
          }
          this.shopItemList = value;
        },
        setNewPhoneOrderList(value){
          if(value.length > 0 ){
            this.phoneOrdedrList = value
          }
        }
    },
    //第一个参数为id值最好与文件名同名，第二参数为配置对象
    state(){ //真正存储数据的地方
        return {
            orderList:[
                
            ],
            shoppingCarList:[
                
            ],
            userInfo:{
                userName:'user1001',
                user_id:'use12345678',
                phoneNum:13912345678,
                address:'湖南长沙',
                tap:false,
                believe:345
            },
            pricePrent:8,
            shopItemList:[
                //商品列表展示
                {
                  imgUrl: shopImg1,
                  imgName: "华为畅享 70X",
                  imgResInfo: "一键北斗 鸿蒙安全，华为巨鲸长续航",
                  imgPrice: "¥1999",
                  orderType:'',
                  _id:'user100111111111',
                  sale_num:'5'
                },
                {
                  imgUrl: shopImg2,
                  imgName: "Mate 70 ",
                  imgResInfo: "鸿蒙AI 红枫原色影像，超可靠玄武架构",
                  imgPrice: "¥5999",
                  orderType:'',
                  _id:'user1001222222',
                  sale_num:'15'
                },
                {
                  imgUrl: shopImg3,
                  imgName: "Mate 70 Pro",
                  imgResInfo: "鸿蒙AI 红枫原色影像，超可靠玄武架构",
                  imgPrice: "¥6699",
                  orderType:'',
                  _id:'user100112121212',
                  sale_num:'10'
                },
                {
                  imgUrl: shopImg4,
                  imgName: "Mate X6",
                  imgResInfo: "分布式玄武架构 鸿蒙大屏AI",
                  imgPrice: "¥15999",
                  orderType:'',
                  _id:'user10013245157',
                  sale_num:'11'
                },
                {
                  imgUrl: shopImg5,
                  imgName: "nova 13",
                  imgResInfo: "前置6000万超广角人像 AI修图 北斗定位",
                  imgPrice: "¥2599",
                  orderType:'',
                  _id:'user1001425577561',
                  sale_num:'9'
                },
                {
                  imgUrl: shopImg6,
                  imgName: "Pocket2",
                  imgResInfo: "超平整超可靠,全焦段MAXGE四摄",
                  imgPrice: "¥6999",
                  orderType:'',
                  _id:'user10019765354',
                  sale_num:'8'
                },
                {
                  imgUrl: shopImg7,
                  imgName: "Pura 70",
                  imgResInfo: "超高速风驰闪拍，第二代昆仑玻璃",
                  imgPrice: "¥5499",
                  orderType:'',
                  _id:'user1001888665445',
                  sale_num:'7'
                },
                {
                  imgUrl: shopImg8,
                  imgName: "Pura 70 Pro",
                  imgResInfo: "超聚光微距长焦，超高速风驰闪拍",
                  imgPrice: "¥6199",
                  orderType:'',
                  _id:'user100156785743t786',
                  sale_num:'5'
                },
              ],
              mailList:[
                {
                    sender:'admin1001',
                    reciver:'user1001',
                    message:'暂无售后相关信息展示',
                    time:'2025年5月1日 10:30:15',
                    _id:'user1001time8367751w55'
                }
              ],
              contextNameTitle:0,
              admininstorInfo:{
                _id:"admmin1001",
                phoneNum:'13912345678',
                plant:'支付宝', //所属平台
                rentNum:'55', //在租数量
                saleNum:'50', //已售数量
                admininstorName:'admin1001'
              },
              phoneOrdedrList:[
                {
                  item_p:5499,
                  item_n:'Pura 70',
                  item_id:'user10056rt574ui899',
                  item_info:'Pura 70 rent',
                  item_type:true,
                  item_form:'admin1001',
                  item_rec:'user1001',
                  item_time:'2025年5月1号'
                }
              ]
        }
    }
})